import React, {Component} from 'react';
import {Popup, Tab,Button,Group,Field ,NumberPicker,SelectField, TextField,NoticeBar,CheckboxField } from 'saltui';
import Number from  '../../room/Number'
import RoomEdit from  '../../form/sub/RoomEdit'


/**
 *  <CheckIn room   buttonName >
 */
export default class RManagedetail extends React.Component {
  constructor(props) {

    super(props);
    this.state = {
      prices: [],
      room: this.props.room
    };
    this.state.buttonName = this.props.buttonName;
    this.roomStatus = {
      1: 'H-room-status-undefined',
      2: 'H-room-status-readly',
      3: 'H-room-status-booked',
      4: 'H-room-status-lock',
    };

    this.className = ['room-list-right','t-R5'];
    this.className.push(this.roomStatus[this.props.room.status]);
  }

  onChange = (id, value) => {
    console.info(value);
  }

  handleTextChange = (id, value) => {
    console.info(value);
  }

  componentWillReceiveProps(nextProps){
    this.className.pop();
    this.className.push(this.roomStatus[nextProps.room.status]);
  }

  render() {
    return <div className={this.className.join(' ')} onClick={() => {
      Popup.show(<RoomEdit typeid={this.props.typeid} onChange={this.props.onChange} {...this.props.room} option={this.props.option} />, {
        animationType: 'slide-down',
      });
    }}>
      <span>{this.props.room.room_name}</span>
      <span>{this.props.room.typeName}</span>
    </div>
  }
}
